Skip to contentSkip to conversation

radeon buffer allocation failure during startup of Factorio

Bug 100242 [email protected] 1 participant 14 messages Mar 16, 2017 – Jul 3, 2017

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=100242

Bug ID: 100242
Summary: radeon buffer allocation failure during startup of
Factorio
Product: Mesa
Version: git
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/Gallium/r600
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]

Created attachment 130277
--> https://bugs.freedesktop.org/attachment.cgi?id=130277&action=edit
terminal output when running the executable

The game Factorio crashes during startup with the following message printed on the CLI:

radeon: Failed to allocate a buffer:
radeon:    size      : 268435456 bytes
radeon:    alignment : 16384 bytes
radeon:    domains   : 4
radeon:    flags     : 20

The crash occurs during the pre-game loading procedure, before reaching the main menu, at the same spot every time. I'm on Lubuntu 16.10 using the up-to-date drivers provided by
https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers , my GPU is a Radeon HD 4670 with AGP. I believe this is a driver issue since the game starts up normally with 16.10's default drivers (12.0.6). I unfortunately cannot provide a specific date or build for when this behavior started occurring, but it has been happening for several months.

Of note is that the demo version provided by the developer on their website does not have this problem and starts up fine.

Attached are the terminal output, an strace and a gdb bt log.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

--- Comment #2 from [email protected] ---
Created attachment 130279
--> https://bugs.freedesktop.org/attachment.cgi?id=130279&action=edit
gdb bt

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

--- Comment #3 from [email protected] ---
I retested the game with mesa 12.0.6 and xserver-xorg-video-radeon 1:7.7.1 (the current versions for default Lubuntu 16.10) and noticed that while the game doesn't crash, it still produces buffer allocation failures during startup:

2.969 Initial atlas bitmap size is 8192

radeon: Failed to allocate a buffer:
radeon:    size      : 268435456 bytes
radeon:    alignment : 16384 bytes
radeon:    domains   : 4
radeon:    flags     : 20
radeon: Failed to allocate a buffer:
radeon:    size      : 268435456 bytes
radeon:    alignment : 16384 bytes
radeon:    domains   : 4
radeon:    flags     : 20
radeon: Failed to allocate a buffer:
radeon:    size      : 268435456 bytes
radeon:    alignment : 16384 bytes
radeon:    domains   : 4
radeon:    flags     : 20
radeon: Failed to allocate a buffer:
radeon:    size      : 268435456 bytes
radeon:    alignment : 16384 bytes
radeon:    domains   : 4
radeon:    flags     : 20

3.029 Couldn't create atlas bitmap (size 8192x8182), will try again 3.094 Created atlas bitmap 4096x4096

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

--- Comment #4 from Christian König <[email protected]> --- The maximum size for allocations in VRAM on radeon are usually 256MB minus pinned system resources like GART.

The game tries to allocate something which is 256MB in size, so that won't fit.

Either the driver tries to allocate a temporary buffer which is way to large or the game tries to allocate a texture which is way to large.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

Michel Dänzer <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |NOTOURBUG

--- Comment #5 from Michel Dänzer <[email protected]> --- (In reply to tnmailinglists from comment #3)

Quoted 2 lines

3.029 Couldn't create atlas bitmap (size 8192x8182), will try again 3.094 Created atlas bitmap 4096x4096

Looks like the game now gracefully handles the failure to allocate an 8192x8192 (= 256MB) atlas texture and falls back to a 4096x4096 one. The crash before was probably a game bug.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

[email protected] changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|NOTOURBUG                   |---
             Status|RESOLVED                    |REOPENED

--- Comment #6 from [email protected] ---
(In reply to Michel Dänzer from comment #5)

Quoted 7 lines

(In reply to tnmailinglists from comment #3)

Quoted 2 lines

3.029 Couldn't create atlas bitmap (size 8192x8182), will try again 3.094 Created atlas bitmap 4096x4096

Looks like the game now gracefully handles the failure to allocate an 8192x8192 (= 256MB) atlas texture and falls back to a 4096x4096 one. The crash before was probably a game bug.

I think you are misreading my comment, I was using an older stable version of mesa there to make sure that it still worked as described in the original post. I did not change the game version. It does not crash with mesa 12.0.6 and radeon 1:7.7.1, but it does crash on mesa 17.1 git with radeon 1:7.9.0. It could still be a game bug, but I'd guess something has changed in the way the driver does buffer allocation if it crashes in one case but not the other with the same game executable.

I've reopened for now since the crash still happens on git mesa, feel free to close again if I misunderstood what you meant.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

Michel Dänzer <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

 Attachment #130279|text/x-log                  |text/plain
          mime type|                            |
Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author Reviewed-by Marek Olšák
#9 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

--- Comment #8 from [email protected] ---
I managed to bisect mesa and got this result:

https://cgit.freedesktop.org/mesa/mesa/commit/?id=fb827c055cb1bdd2b18d0687c06c56b537d805f3
is the first bad commit
commit fb827c055cb1bdd2b18d0687c06c56b537d805f3

Author: Nicolai Hähnle <[email protected]>
Date:   Mon Sep 12 12:19:47 2016 +0200

winsys/radeon: enable buffer allocation from slabs

Only enable for chips with GPUVM, because older driver paths do not take
the
required offset into account.

:040000 040000 4e1327d4b72890178a2057d2341971001f2de54d
d162404a219307e5f6cda1009b864e66f23f4e63 M src

I have also noticed that after a recent update the game now gives some more information, so when it does run like described in comment #3, it now also tells me that it detected an error by adding the following line right after the four driver error blocks:

2.321 glTexImage2D for format ARGB_8888, size 8192x8185 failed
(GL_OUT_OF_MEMORY)

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

Michel Dänzer <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #9 from Michel Dänzer <[email protected]> --- Looks like Nicolai's change caused a regression for non-VM GPUs.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

--- Comment #10 from Nicolai Hähnle <[email protected]> --- Created attachment 132275
--> https://bugs.freedesktop.org/attachment.cgi?id=132275&action=edit
likely fix

It is a silly bug. The attached patch should fix the crash you're seeing. Please let me know if the game runs fine with this or if there is any other crash you're running into. Thanks!

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

--- Comment #11 from [email protected] ---
The game starts up fine without a crash now and handles the out of memory error gracefully like before. Thanks!

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#13 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=100242

Nicolai Hähnle <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #12 from Nicolai Hähnle <[email protected]> --- Thanks for testing again. The fix is in Mesa master, commit b0b4b5e8f7a25dd11c1662d339d68c9733e9b2dc.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel